﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using System.Windows.Media;
using Microsoft.Phone.Maps.Toolkit;
using Microsoft.Phone.Maps.Controls;
using System.Device.Location;
using SpaceNeedle.x6473.WindowsPhone.ViewModels;
using SpaceNeedle.x6473.WindowsPhone.Common;
using Windows.Networking.Connectivity;
using SpaceNeedle.SDK.WindowsPhone.Views;
using SpaceNeedle.SDK.WindowsPhone;


namespace SpaceNeedle.x6473.WindowsPhone.Views
{
    public class NewRequestView : ViewBase<NewRequestViewModel> { }

    public partial class NewRequest : NewRequestView
    {
        public NewRequest()
        {
            InitializeComponent();
        }

        private void OnRequestsListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if(e.AddedItems.Count == 0)
            {
                return;
            }

            AppViewModel.Instance.Properties.SelectedRequest = e.AddedItems[0] as Models.Request;
            AppServices.Current.NavigationService.NavigateDirect(ViewsUris.Request);
        }

        private void OnUploadsMenuItem_Click(object sender, EventArgs e)
        {
            this.ViewModel.UploadsCommand.Execute(null);
        }

        private void OnAboutMenuItem_Click(object sender, EventArgs e)
        {
            this.ViewModel.AboutCommand.Execute(null);
        }

        private void OnSignOutMenuItem_Click(object sender, EventArgs e)
        {
            this.ViewModel.SignOutCommand.Execute(null);
        }
    }
}